#include <windows.h>
#include <stdio.h>
#include <string.h>
#define LEN 1024
BOOL  DirectoryList(LPCSTR Path)
{
 WIN32_FIND_DATAA FindData;
 HANDLE hError;
 int FileCount = 0;
 char FilePathName[LEN];
 // make path
 char FullPathName[LEN];
 strcpy(FilePathName, Path);
 strcat(FilePathName, "\\*.*");
 hError = FindFirstFileA(FilePathName, &FindData);
 if (hError == INVALID_HANDLE_VALUE)
 {
  printf("search fail!");
  return 0;
 }
 while (::FindNextFileA(hError, &FindData))
 {

  if (strcmp(FindData.cFileName, ".") == 0 
   || strcmp(FindData.cFileName, "..") == 0 )
  {
   continue;
  }
  

  wsprintfA(FullPathName, "%s\\%s", Path,FindData.cFileName);
  FileCount++;

  printf("\n%d  %s  ", FileCount, FullPathName);

  if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
  {
   printf("<Dir>");
   DirectoryList(FullPathName);
  }



 }
 return 0;
}

//#define RecusiveFolderMain main

void RecusiveFolderMain()
{
	DirectoryList("D:\\workspace\\test\\avicap");
}